package com.edu.app.mapper.core;

import com.edu.app.bean.core.SysTenant;

import com.edu.app.util.AppBaseMapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

@Component
public interface SysTenantMapper extends AppBaseMapper<SysTenant> {
    //采用通用Mapper，也可以在这里添加自己的Mapper
    @Select("SELECT * FROM S_TENANT WHERE PHONE=#{phone}")
    SysTenant getTenantByPhone(String phone);

    @Select("insert into s_tenant(create_time,create_by,update_time,update_by,company,start_date,end_date,type_cd) " +
            "values(#{sysTenant.create_time},#{sysTenant.create_by},#{sysTenant.update_time},#{sysTenant.update_by}," +
            "#{sysTenant.company},#{sysTenant.start_date},#{sysTenant.end_date},#{sysTenant.type_cd})")
    @Options(useGeneratedKeys = true, flushCache= Options.FlushCachePolicy.TRUE, keyProperty = "id", keyColumn = "id")
    Integer addRecord(@Param("sysTenant") SysTenant sysTenant);

}
